Page({
  data: {
    // 是否有已选工厂范围
    isselectFacScope: false,
  },
  onLoad() {

  },

  onShow() {
    this.getStorage()
  },

  toPage(e) {
    let val = e.target.dataset.val
    let url = '/pages/' + val + '/' + val
    if (this.data.isselectFacScope) {
      dd.navigateTo({
        url: url
      })
    } else {
      dd.navigateTo({
        url: '/pages/selectRange/selectRange?passType=' + val
      })
    }

  },

  // 获取工厂范围
  getStorage() {
    let that = this
    dd.getStorage({
      key: 'selectFacScope',
      success: function (res) {
        console.log(res.data)
        if (res.data) {
          that.data.isselectFacScope = true
        } else {
          that.data.isselectFacScope = false
        }
      }
    });
  }
});
